package org.liuqm.service.impl;

import org.apache.ibatis.session.SqlSession;
import org.liuqm.mapper.SysUserMapper;
import org.liuqm.pojo.vo.SysUserVo;
import org.liuqm.service.ISysUserService;
import org.liuqm.utils.MybatisConfigUtil;

public class SysUserServiceImpl implements ISysUserService {


    @Override
    public SysUserVo loginByUserNameAndPwd(String userName, String pwd) {
        SqlSession session = MybatisConfigUtil.getSqlSession();
        SysUserVo sysUserVo = session.getMapper(SysUserMapper.class).loginByUserNameAndPwd(userName, pwd);
        MybatisConfigUtil.closeSqlSession(session);
        return sysUserVo;
    }

    @Override
    public SysUserVo findUserById(String userId) {
        SqlSession session = MybatisConfigUtil.getSqlSession();
        SysUserVo sysUserVo = session.getMapper(SysUserMapper.class).findUserById(userId);
        MybatisConfigUtil.closeSqlSession(session);
        return sysUserVo;
    }
}
